//时间
setInterval(function () {
    var date = new Date()
    $('.date').text(date);
}, 1000);

//客服效果
$('.jp-right-title').mouseenter(function () {
    $('.jp-right').css('right', '0rem');
});
$('.jp-right').mouseleave(function () {
    $('.jp-right').css('right', '-15rem');
});

//bar2-2结果
$(document).ready(function () {
    autogetbar2();
});

function autogetbar2() {
    bar2get(1);
    bar2get(2);
    bar2get(3);
}
function bar2get(num) {
    var url = {
        url1: 'http://iceonlyice.vicp.net:3000/data/last10?gamekind=pk10',
        url2: 'http://iceonlyice.vicp.net:3000/data/last10?gamekind=bjkl',
        url3: 'http://iceonlyice.vicp.net:3000/data/last10?gamekind=jndkeno',
        url4: 'http://iceonlyice.vicp.net:3000/data/last10?gamekind=18bkeno'
    };
    var fnum = 21;
    if (num == 1) {
        fnum = 11
    }
    $.ajax({
        type: "GET",
        url: url['url' + num],
        dataType: "json",
        success: function (data) {
            var html = '';
            data.data.forEach(function (e) {
                var total;
                if (e.rtotal) {
                    total = e.rtotal;
                } else {
                    total = '';
                }
                html += '<li class=" clearfix"><span class="gnum">' + e.gameid + '</span><span class="fball">' + e.r1 + '</span>';
                for (var i = 2; i < fnum; i++) {
                    html += '<span>' + e["r" + i] + '</span>'
                }
                html += '<span class="gtotal">' + total + '</span><span class="gdate">' + e.opentime + '</span></li>';
            })
            html += '';
            $('.bar2-2-main > ul').eq(num - 1).html(html);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.log(errorThrown);
        }
    });
}
var autotimegetbar2 = setInterval(autogetbar2, 30000);

$('.bar2-2ul >li').mouseover(function () {
    var n = $(this).index();
    $(this).addClass('bar2-2-titactive').siblings().removeClass('bar2-2-titactive');
    $('.bar2-2-main > ul').eq(n).fadeIn().siblings().fadeOut()
});